<?php
    require_once ("config.php");
    
    $filename = getFileName();
    if (!file_exists($filename)) {
        $_GET['_page'] = 'error';
        $filename = getFileName();
    }
    
    require_once($filename);
    
    $page = Page::load(ucfirst($_GET['_page']), $_GET['_action']);
    if ($page) {
        $page->render();
    }
    
    if (isset($_GET['debug'])) {
        var_dump($_GET, $_POST);
    }